package com.demon.mutehelper.dao

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy
import androidx.room.Query
import com.demon.mutehelper.bean.MuteRecord
import kotlinx.coroutines.flow.Flow

@Dao
interface MuteRecordDao {
  @Query("SELECT * FROM muterecord")
  fun getAll(): Flow<List<MuteRecord>>

  @Query("SELECT * FROM muterecord WHERE id = :id")
  fun getRecordById(id: Int): Flow<MuteRecord>

  @Delete
  fun deleteRecord(record: MuteRecord)

  @Insert(onConflict = OnConflictStrategy.REPLACE)
  fun insertOrUpdateRecord(record: MuteRecord)

}